<%@page import="java.util.Date"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="java.util.ArrayList"%>
<style>
.aniversariante:hover {
	background-color: #CED9E2;
}
</style>

<%@page import="com.liferay.portal.theme.ThemeDisplay"%>
<%@page import="com.liferay.portal.service.ImageLocalServiceUtil"%>
<%@page import="com.liferay.portal.service.ImageLocalService"%>
<%@page import="java.util.List"%>
<%@page import="com.liferay.portal.kernel.util.WebKeys"%>
<%@page import="com.liferay.portal.model.User"%>
<%@page import="com.liferay.portal.service.UserLocalServiceUtil"%>

<%
	/**
	 * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
	 *
	 * This library is free software; you can redistribute it and/or modify it under
	 * the terms of the GNU Lesser General Public License as published by the Free
	 * Software Foundation; either version 2.1 of the License, or (at your option)
	 * any later version.
	 *
	 * This library is distributed in the hope that it will be useful, but WITHOUT
	 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
	 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
	 * details.
	 */
%>

<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet"%>
<%@ taglib uri="http://liferay.com/tld/theme" prefix="theme"%>

<portlet:defineObjects />
<theme:defineObjects />
<%
	// 	Long userIdObj = (Long) request.getAttribute(WebKeys.USER_ID);

	// 	User userLogged = UserLocalServiceUtil.getUserById(userIdObj);

	SimpleDateFormat formatter = new SimpleDateFormat("dd-MM");

	// 	int count = UserLocalServiceUtil.getUsersCount();
	// 	List<User> aniversariantes = new ArrayList<User>();

	List<User> users = UserLocalServiceUtil.getUsers(1, 1000);
%>
<table width="100%">

	<%
		for (User u : users) {
			String birth = formatter.format(u.getBirthday());
			String today = formatter.format(new Date());
			if(birth.equals(today)){
	%>
	<portlet:renderURL var="emailFormURL">
		<portlet:param name="jspPage" value="/edit.jsp" />
		
	</portlet:renderURL>

	<tr class="aniversariante">
		<td width="100"><img width="80" style="border: 1px solid black;"
			src="<%=themeDisplay.getPathImage()%>/user_portrait?img_id=<%=u.getPortraitId()%>">
		</td>
		<td valign="middle"><span style="font-size: large"><%=u.getJobTitle() + " " + u.getFirstName()%></span><br />
			<%
				if(u.getOpenId() != null && u.getOpenId() != ""){
			%>
			Ramal: <%= u.getOpenId() %>
			<% 
				}
			%>
			
			<br/>
		    <a href="<%= emailFormURL %>?id=30">Envie uma mensagem.</a></td>
		    
	</tr>
	<%
		}
		}
	%>

</table>
